package com.mtbu.bean;
import java.util.HashMap;
import java.util.Map;

import com.mtbu.bean.base.SysUserBase;
public final class SysUser extends SysUserBase {
	
    Map<String, String> funcmap = new HashMap<String, String>();
    Map<String, String> catamap = new HashMap<String, String>();

    public Map<String, String> getFuncmap() {
        return funcmap;
    }

    public void setFuncmap(Map<String, String> funcmap) {
        this.funcmap = funcmap;
    }

    public Map<String, String> getCatamap() {
        return catamap;
    }

    public void setCatamap(Map<String, String> catamap) {
        this.catamap = catamap;
    }
    
    public boolean isOwnerOfStep(int stepId){
    	String mark = "," + stepId + ",";
    	String permission = "," + getStepPermission() + ",";
    	
    	System.out.println(mark);
    	System.out.println(permission);
		if (permission.indexOf(mark) >= 0) {
			return true;
		}
		System.out.println(false);
		return false;
			
    }
    
    public void setStepPermission(String[] stepIds){
    	StringBuffer sb = new StringBuffer();
    	
    	for (String id : stepIds) {
    		sb.append(id);
    		sb.append(',');
		}
    	try {
			sb.deleteCharAt(sb.length()-1);
		} catch (Exception e) {
			// TODO: handle exception
		}
    	setStepPermission(sb.toString());
    }
}
